/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2025-06-00     YTR       the first version
 */
#ifndef APPLICATIONS_MPU6050_H_
#define APPLICATIONS_MPU6050_H_


void MPU_6050_Init(void);
unsigned char  MPU_Set_LPF(unsigned short lpf);
//DMP库需要的函数
unsigned char HAL_i2c_write(unsigned char slave_addr, unsigned char reg_addr, unsigned char length, unsigned char const *data);
unsigned char HAL_i2c_read(unsigned char slave_addr, unsigned char reg_addr, unsigned char length, unsigned char const *data);
//读取 温度传感器   陀螺仪  加速度数据
void read_all(void);
//陀螺仪方向控制
unsigned short inv_orientation_matrix_to_scalar(const signed char *mtx);
//方向转换
unsigned short inv_row_2_scale(const signed char *row);
//MPU6050自测试
//返回值:0,正常
//    其他,失败
unsigned char run_self_test(void);
//mpu6050,dmp初始化
//返回值:0,正常
//    其他,失败
unsigned char mpu_dmp_init(void);
//得到dmp处理后的数据(注意,本函数需要比较多堆栈,局部变量有点多)
//pitch:俯仰角 精度:0.1°   范围:-90.0° <---> +90.0°
//roll:横滚角  精度:0.1°   范围:-180.0°<---> +180.0°
//yaw:航向角   精度:0.1°   范围:-180.0°<---> +180.0°
//返回值:0,正常
//    其他,失败
unsigned char mpu_dmp_get_data(float *pitch,float *roll,float *yaw);
void MPU6050_Init(void);
#endif /* APPLICATIONS_MPU6050_H_ */
